'''
	Andrew Oberlin
	Date: March 12, 2012
'''
class EnemyAI:
	'''
		Constructs the dictionaries used for the
		AI. 
		
		Also, adds the different collision
		sphere's for detecting enemies within a certain
		radius.
		
		Each enemy is assumed to have its own collision
		detection for bumping into things already implemented.
	'''
	def __init__(self, parent, buildings, units):
		self.parent = parent
		self.buildings = buildings
		self.units = units
	
	'''
		If there is someone attacking your friend
		you will go and help your friend out!
	'''
	def helpTask(self, task):
		helping = False
		for key in self.units.keys():
			if (self.units[key].attackTaskGo):
				attackedKey = key
				helping = True
				break;
		
		if (helping):
			for key in self.units.keys():
				self.units[key].attack(self.units[attackedKey].target)